package com.sh.rbac.core.common.result;

import lombok.Getter;

/**
 * 全局统一返回结果枚举类
 *
 * @author qy
 */

@Getter
public enum ResultCodeEnum {
    SUCCESS(200, "成功"),
    FAIL(201, "失败"),

    SERVER_ERROR(500, "服务器异常"),
    BODY_IS_NULL(204, "请求正文为空"),


    // 权限认证相关
    TOKEN_NOT_EXIST(200, "token不存在"),
    AUTH_SIGN_INVALID(201, "无效签名"),
    AUTH_TOKEN_EXPIRED(202, "token过期"),
    AUTH_ALG_INVALID(203, "无效算法"),
    AUTH_TOKEN_INVALID(204, "token无效"),
    AUTH_ERROR(205, "用户认证失败, 请重新登录"),

    AUTH_NOT_PERMISSION(206, "权限不足, 请联系管理员"),

    AUTH_NOT_LOGIN(209, "未登录, 请登录"),

    CRON_ERROR(210, "cron 表达式格式错误!"),
    CLASS_NOT_FIND(210, "类不存在"),

    CODE_ERROR(208, "验证码错误"),
    USERNAME_PASSWORD_ERROR(207, "用户名或密码错误"),
    OLD_PASSWORD_ERROR(208, "旧密码错误"),


    NODE_HAS_CHILDREN(210, "该节点下有子节点，不能删除"),

    DATA_EXPORT_ERROR(211, "数据导出失败"),

    CODE_NOT_FOUND(212, "验证码不存在"),
    NOT_DATA_SCOPE(213, "没有数据访问权限"),
    USERNAME_EXIST(214, "用户名已存在"),

    FILE_NOT_FIND(208, "文件不存在"),
    FILE_UPLOAD_ERROR(215, "文件上传失败"),
    STORAGE_NOT_CONFIG(216, "未配置文件存储"),
    FILE_DOWNLOAD_ERROR(217, "文件下载失败"),
    USERNAME_NOT_NULL(218, "用户名不能为空"),
    PASSWORD_NOT_NULL(219, "密码不能为空"),
    CAPTCHA_NOT_NULL(220, "验证码不能为空");


    private final Integer code;

    private final String message;

    ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
}
